Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new controller rule enforcing use of @Validated #124

Closed
wants to merge 1 commit into from

Conversation

tobHai
Copy link
Contributor

@tobHai tobHai commented Nov 20, 2024

Hi!

I think it would be useful to have another rule checking that all controllers are annotated with @Validated otherwise validation annotations on RequestParams or PathVariables won't be checked.

@mnhock what do you think about that proposal? Is it to specific?

Copy link

sonarcloud bot commented Nov 20, 2024

@mnhock
Copy link
Member

mnhock commented Nov 20, 2024

Thanks for the idea!

Maybe the check should be like this?

If a controller method has a parameter annotated with @PathVariable or @RequestParam and a validation annotation (e.g., @min, @NotNull, etc.), the class must also be annotated with @validated.

@mnhock mnhock added the enhancement New feature or request label Nov 20, 2024
@tobHai
Copy link
Contributor Author

tobHai commented Nov 20, 2024

Yes, that would be even better!

@mnhock
Copy link
Member

mnhock commented Nov 21, 2024

I will adjust the changes to your PR, thanks!

@mnhock mnhock added this to the 1.5.0 milestone Nov 21, 2024
@mnhock mnhock marked this pull request as ready for review November 21, 2024 15:41
@mnhock mnhock closed this Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants